package com.sky.repository;

import com.sky.entity.Note;
import io.lettuce.core.dynamic.annotation.Param;
import io.swagger.models.auth.In;
import jdk.jfr.Registered;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface NoteRepository extends MongoRepository<Note, String> {

    List<Note> findByuId(Integer uId);

    @Query("{ 'u_id': ?0, 'b_id': ?1 }")
    List<Note> findByuIdAndbId(Integer uId, String bId);
    @Query("{'status': ?0}")
    Page<Note> findByStatus(Integer status, Pageable pageable);
}